home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
7_10.lha
/
7_10
/
p_wakeup.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
1KB
|
41 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
include <process.h>
include <debug.h> /* DELETE */
/ Wake up the given process by
/ moving it to the run list,
/ possibly with a time offset.
oid process::wakeup(unsigned long t)
if (debug) /*DELETE*/ cerr << "process" << this << "::wakeup(" << t << ")\n";
if (debug) /*DELETE*/ cerr << "\tt_curtime == " << t_curtime << "\n";
switch (t_curstate)
{
case TASK_TERMINATED:
error("trying to wakeup terminated process");
return;
case TASK_IDLE:
rmfromlist(this, &t_waitprocesses);
break;
case TASK_CURRENT:
break;
case TASK_RUNNABLE:
rmfromlist(this, &t_runprocesses);
break;
}
t_desiredtime = t ? t_curtime + t : 0;
t_curstate = TASK_RUNNABLE;
if (debug) /*DELETE*/ cerr << "\tt_desiredtime <- " << t_desiredtime << "\n";
t_next = t_runprocesses;
t_runprocesses = this;
shufflerunlist();
if (debug) /*DELETE*/ cerr << "<<<< process" << this << "::wakeup(" << t << ")\n";